# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=imake
pkgver=1.0.9
pkgrel=2
pkgdesc="X.Org imake program and related utilities"
arch=('loong64' 'x86_64')
url="https://xorg.freedesktop.org/"
license=('custom')
depends=('glibc')
makedepends=('pkgconfig' 'xorgproto' 'perl' 'xorg-util-macros' 'xorg-font-util')
optdepends=('perl: for mkhtmlindex')
source=(https://xorg.freedesktop.org/archive/individual/util/imake-${pkgver}.tar.xz{,.sig}
        https://xorg.freedesktop.org/releases/individual/util/gccmakedep-1.0.3.tar.bz2
        https://xorg.freedesktop.org/releases/individual/util/lndir-1.0.4.tar.xz{,.sig}
        https://xorg.freedesktop.org/releases/individual/util/makedepend-1.0.8.tar.xz{,.sig}
        https://xorg.freedesktop.org/releases/individual/util/xorg-cf-files-1.0.8.tar.xz{,.sig}
        linuxconfig.patch
        LICENSE)
sha512sums=('e7587cf80369c8f4fcc1207c13bcb74a53d838b504ac8a7f3b98fb8f5f595cc7b8e5e9fad50cadcf40cf27bd02ef4eae7fe458854bbed7bea27d474d66520644'
            'SKIP'
            '563b2897770a4df2792ea3eae8183a1f9e78192b7efc9c8296ee68d1cba6e72fa962a88e3251bb780df776e2aa7e80d74d5096675c61526c232aefa4f9e6a5fc'
            '71ebebaa9edb1ffe9d833cf23241bd7d99f4704a2eec20638eb9af1ff34bd42882557dadbcbe84a9e26f9d885caf1e555dca4756efd9915ca7642e39a8c6f711'
            'SKIP'
            '6707b1107c07d4ffbcf008181e877d18a0bcc4aea03860ee1158f5630c7fdce4cf9ad7bee3b38ee420c3a44819ed4b56a6f2428a5b695c0dbd17fb3e60825a6d'
            'SKIP'
            'cc633af889cd82346c3098df9185245c21aa9db7484343f8be9719f6e0b1fc0a9b09afb13b9b864668aa51944f2da797bbe896c807f629e89fc91506e6e63fb9'
            'SKIP'
            'e2a42d60ca39a14ac7944af04eb76dfe9b194cfad8d853730a29aa43f93f2b4acce8d6e8d7a36901b201822c8c5879093fadb6e63f448f5915878909e3797735'
            '1ded8ef51405e3b0144a633b612270cb1c71e7365852653284a587972f68a390252ca73350517bac621006cab6410745974a960d9fd0d3f76dcb9face69aada9')
validpgpkeys=('4A193C06D35E7C670FA4EF0BA2FB9E081F2D130E') #Alan Coopersmith <alan.coopersmith@oracle.com>

prepare() {
  cd xorg-cf-files-1.0.8
  patch -p1 -i ../linuxconfig.patch
}

build() {
  for i in *; do
    if [ -d "${i}" ]; then
      pushd "${i}"
      autoreconf -fi
      ./configure --prefix=/usr --mandir=/usr/share/man
      make
      popd
    fi
  done
}

package() {
  for i in *; do
    if [ -d "${i}" ]; then
      pushd "${i}"
      make DESTDIR="${pkgdir}" install
      popd
    fi
  done
  install -D -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
